//
//  CViewController.swift
//  test
//
//  Created by lyl on 2019/12/12.
//  Copyright © 2019年 lyl. All rights reserved.
//

import UIKit

class CViewController: UIViewController {

    override func viewDidLoad() {
        super.viewDidLoad()
        
        view.backgroundColor = .white

        let leftBarBtn = UIBarButtonItem(image: UIImage(named: "icon_001"), style: .plain, target: self, action: #selector(backToPrevious))
        self.navigationItem.leftBarButtonItem = leftBarBtn;
        
        // 3.创建新的手势
        let pan = UISwipeGestureRecognizer(target: self, action: #selector(backToPrevious))
        pan.direction = .right
        view.addGestureRecognizer(pan)
    }
    

    //返回按钮
    @objc func backToPrevious(){
        print(".........")
        self.navigationController?.popToRootViewController(animated: true)
    }
    /*
    // MARK: - Navigation

    // In a storyboard-based application, you will often want to do a little preparation before navigation
    override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
        // Get the new view controller using segue.destination.
        // Pass the selected object to the new view controller.
    }
    */

}
